package day5.homework2;

import java.util.Scanner;

public class HomeWork2 {
    public static void main(String[] args) {
        int count = 4;
        Scanner input = new Scanner(System.in);
        Guess guess = new Guess();
        guess.init(); // 初始化商品
        Commodity commodity = guess.draw(); // 用户抽取商品
        System.out.print("请猜测【"+commodity.commodityName+"】的价格：");
        for (int i = 0; i < count; i++) {
            guess.inputPrice = input.nextInt();
            Result result = guess.playGuess();
            // 最后一次的情况
            if(i == count - 1 && result != Result.OK) {
                System.out.println(count + "次没猜对，下次努力吧！");
                break;
            }
//            switch (result) {
//                case HIGH:
//            }

            if (result == Result.HIGH) {
                System.out.println("再小点!");
            } else if (result == Result.LOW) {
                System.out.println("再大点!");
            } else {
                System.out.println("猜对了!");
                break;
            }
            System.out.print("再猜一次吧:");
        }

    }
}
